﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using FanaticRock.AudioManage.Helpers;
using FanaticRock.Helpers;

namespace FanaticRock.AudioManage.Models
{
    public class SongMetadata
    {
        public string Path;

        public string Id;

        public string Name;

        public string Album;

        public string[] Performers;

        public string FirstPerormer;

        public string JoinedPerformers;

        public byte[] AlbumCoverImageBytes;

        public TimeSpan Duration;

        public SongMetadata(string path)
        {
            Path = path;
            Id = FileHelper.CreateFileId(path);
            Name = System.IO.Path.GetFileNameWithoutExtension(path);
            using var file = TagLib.File.Create(path);
            Duration = file.Properties.Duration;
            var tag = file.Tag;
            Album = tag.Album;
            Performers = tag.Performers;
            FirstPerormer = tag.FirstPerformer;
            JoinedPerformers = tag.JoinedPerformers;
            AlbumCoverImageBytes = AudioFormatHelper.GetCover(file);

            //FirstArtist = 
        }

    }
}
